package org.lc.stk.model.question;

import java.util.Date;
import java.util.List;

import org.hibernate.annotations.Comment;
import org.lc.stk.model.course.Chapter;
import org.lc.stk.model.course.Course;
import org.lc.stk.model.course.KnowledgePoint;
import org.lc.stk.model.question.attrs.QuestionAttribute;
import org.lc.stk.model.question.attrs.QuestionState;
import org.lc.stk.model.question.attrs.QuestionType;
import org.lc.stk.model.user.User;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Inheritance;
import jakarta.persistence.InheritanceType;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;

@Entity
@Table(name = "question")
@Inheritance(strategy = InheritanceType.JOINED)
@Comment("试题基类")
public abstract class Question {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @ManyToOne
    @Comment("题目类型")
    private QuestionType type;

    @ManyToOne
    @Comment("题目属性")
    private QuestionAttribute attribute;

    @ManyToOne
    @Comment("题目状态")
    private QuestionState state;

    @ManyToOne
    @Comment("出题人")
    private User questionSetter;

    @Temporal(TemporalType.TIMESTAMP)
    @Comment("创建时间")
    private Date createDate;

    @Temporal(TemporalType.TIMESTAMP)
    @Comment("更新时间")
    private Date updateDate;

    @ManyToOne
    @Comment("所属课程")
    private Course course;

    @ManyToOne
    @Comment("所属章节")
    private Chapter chapter;

    @ManyToMany
    @Comment("知识点")
    private List<KnowledgePoint> knowledgePoints;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public QuestionType getType() {
        return type;
    }

    public void setType(QuestionType type) {
        this.type = type;
    }

    public QuestionAttribute getAttribute() {
        return attribute;
    }

    public void setAttribute(QuestionAttribute attribute) {
        this.attribute = attribute;
    }


    public QuestionState getState() {
        return state;
    }

    public void setState(QuestionState state) {
        this.state = state;
    }

    public User getQuestionSetter() {
        return questionSetter;
    }

    public void setQuestionSetter(User questionSetter) {
        this.questionSetter = questionSetter;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Course getCourse() {
        return course;
    }

    public void setCourse(Course course) {
        this.course = course;
    }

    public Chapter getChapter() {
        return chapter;
    }

    public void setChapter(Chapter chapter) {
        this.chapter = chapter;
    }

    public List<KnowledgePoint> getKnowledgePoints() {
        return knowledgePoints;
    }

    public void setKnowledgePoints(List<KnowledgePoint> knowledgePoints) {
        this.knowledgePoints = knowledgePoints;
    }
}
